package com.bgs.exception.eg;

public class ExceptionDemo02 {

	public static void main(String[] args) {
		System.out.println("hello exception-fun1::: ");
		int iRet = 0;
		try {
			System.out.println("hello exception-fun1-begin::: " + iRet);
			iRet = fun1();
			System.out.println("hello exception-fun1::: " + iRet);
		} catch (ArithmeticException e) {
			System.out.println("main ArithmeticException-::: " + e.getMessage());
		} catch (Exception e) {
			System.out.println("main exception-::: " + e.getMessage());
			// e.printStackTrace();
		} finally {
			System.out.println("main finally-::: ");
		}
	}
	
	public static int fun1() throws ArithmeticException {
		int a = 10;
		int b = 0;
		int c = 0;
		try {
			c = a / b;
			// throw new Exception("sssssssss");

		} catch(Exception e) {
			System.out.println("exception-fun1()::: " + e.getMessage());
			throw new ArithmeticException(e.getMessage());
		}
		return 110;
	}
	public static void fun2() {
		System.out.println("hello static fun2");
	}
}
